#include <iostream>
using namespace std;

int main()
{
    int m = 4;
    int n = 3;
    int a, t, i, j;

    for(j=1; j<n; j++)
    {
        if (j==1)
            cout << "a" << "\t";
        else
            cout << "a^" << j << "\t";
    }
    cout << "a^" << j << endl;
    for (i=1; i<=m; i++)
    {
        t = 1;
        for(j=1; j<n; j++)
        {
            t = t*i;
            cout << t << "\t";
        }
        t = t*i;
        cout << t <<  endl;
    }

    return 0;
}


